package it.polimi.it.TravelDream.entities;

import it.polimi.it.TravelDream.ejb.eaos.ExcursionDTO;
import it.polimi.it.TravelDream.ejb.eaos.FlightDTO;
import it.polimi.it.TravelDream.ejb.eaos.HotelDTO;
import it.polimi.it.TravelDream.ejb.eaos.PackageDTO;

import java.io.Serializable;

import javax.persistence.*;


/**
 * The persistent class for the purchases database table.
 * 
 */
@Entity
@Table(name="purchases")
@NamedQueries({
	@NamedQuery(name=Purchas.FIND_ALL,
				query="SELECT p FROM Purchas p")
	}
	)
public class Purchas implements Serializable {
	private static final long serialVersionUID = 1L;
	public static final String FIND_ALL = "purchas.findAll";

	@Id
	private String idproduct;

	private String idbuyer;

	public Purchas() {
	}

	public Purchas(PackageDTO pack, String emailBuyer) {
		this.idbuyer = emailBuyer;
	    this.idproduct = pack.getIdPackage();
		
	}
	public Purchas(HotelDTO hotel, String emailBuyer){
		this.idbuyer = emailBuyer;
	    this.idproduct = hotel.getIdbasicproduct();
		
		
	}
	
	public Purchas(ExcursionDTO excursion, String emailBuyer){
		this.idbuyer = emailBuyer;
	    this.idproduct = excursion.getIdbasicproduct();
		
		
	}
	public Purchas(FlightDTO flight, String emailBuyer){
		this.idbuyer = emailBuyer;
	    this.idproduct = flight.getIdbasicproduct();
		
		
	}
	public String getIdproduct() {
		return this.idproduct;
	}

	public void setIdproduct(String idproduct) {
		this.idproduct = idproduct;
	}

	public String getIdbuyer() {
		return this.idbuyer;
	}

	public void setIdbuyer(String idbuyer) {
		this.idbuyer = idbuyer;
	}

}